package tech.aistar.corejava.day10.homework;

/**
 * Created by 李雨昂 on 2019/7/27.
 */
public class Demo08 {
    public static void main(String[] args) {
        String str = "6901234567892";
        int[] arr = new int[str.length() - 1];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = str.charAt(i + 1) - 48;//str.charAt(i)赋值给arr时是把ASCII码赋给arr
        }
        int sum1 = 0;
        int sum3 = 0;
        int sum4;
        for (int i = 0; i < arr.length; i++) {
            if(i % 2 == 0){
                sum1 += arr[i];
            }else{
                sum3 += arr[i];
            }
        }
        System.out.println("sum1 = " + sum1);
        System.out.println("sum3 = " + sum3);
        sum4 = sum1*3 + sum3;
        System.out.println("sum4 = " + sum4);
        for (int i = 0; i < 10; i++) {
            if((sum4 + i) % 10 == 0){
                System.out.println(i);
                break;
            }
        }
    }
}
